-
-
Notifications
You must be signed in to change notification settings - Fork 104
feat: log the number of read/written bytes on IMAP stream read error #6924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
2893f40
to
8efff30
Compare
7ce86bd
to
f6df3ee
Compare
First commit currently adds |
01d9db2
to
5ca9bb1
Compare
Logs look like this:
Now right before the message about IMAP timeout we get a log message with the peer address and the number of read and written bytes. |
5ca9bb1
to
932a8e1
Compare
932a8e1
to
ff537b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read through the code and found 3 minor things, otherwise looks good. But I don't know this code, so, I can's say for sure that I didn't overlook anything - please be sure to double-check yourself, because this is an area where it would be bad to have a bug.
src/log/logging_stream.rs
Outdated
if let Ok(peer_addr) = peer_addr { | ||
let log_message = format!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it on purpose that nothing is logged if the peer_addr is Err?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be impossible, I think to have unbound socket you need to convert it from raw FD. But I'll add a warning in this case and debug_assert.
ff537b8
to
7f0841b
Compare
LoggingStream
is a wrapper for IMAP/SMTP/HTTP session streams. Originally I started building it with the idea to debug #6477 and similar issues where IMAP loop gets stuck with the hope that right before the loop gets stuck or even continuously there are socket errors like a read timeout that are not treated correctly.This can later be expanded to collect the metrics in the database, display them in the connectivity view, but not in this PR. Same for logging the write or flush errors, I have not added it for now because they are less common.